package cn.cmcc.online.smsapi.sdk.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/*SDK-616 hewengao/20160918 start*/
public class SmartSmsThreadPoolManager {

    //后台批理更新企业资料
    public static ExecutorService mUploadPubInfoPool = Executors.newFixedThreadPool(1);
    public final static String TNAME_UPLOAD_PUBINFO ="xy_update_pubinfo_1";
    //网络单个查询，企业资料。
    public static final ExecutorService pubInfoPool = Executors.newFixedThreadPool(2);
    /*SDK-633 hewengao 20161009 start*/
    public final static String TNAME_QUERY_PUBINFO ="xy_query_pubinfo_1";
    //查询logo
    private  static ExecutorService publicLogoPool = null;//Executors.newFixedThreadPool(1);
    public final static String TNAME_PUBLICPOOL="xy_logo_1";
    //查询logo
//    public static ExecutorService publicPool2 = Executors.newFixedThreadPool(1);
//    public final static String TNAME_PUBLICPOOL2="xy_pubpool_1";
    //丰富汽泡识别，特征值识别
    public static ExecutorService richPool = Executors.newFixedThreadPool(1);
    public final static String TNAME_RICHPOOL="xy_richpool_1";
    /*SDK-656 hewengao 20161028 start*/
    private static ExecutorService msgUrlPool = null;
    public final static String TNAME_MSGURLPOOL="xy_msgUrlPool_1";
    /*SDK-656 hewengao 20161028 end*/
    //丰富汽泡识别，ParseBubbleManager
//    public static ExecutorService richPool2 = Executors.newFixedThreadPool(1);
//    public final static String TNAME_RICHPOOL2="xy_rich_1";
    //保存简单汽泡结果
//    public static ExecutorService saveSimpleResultService = Executors.newFixedThreadPool(1);
//    public final static String TNAME_SIMPLE_RESULT="xy_simpleres_1";
//  //解析上报服务，纯后台任务
//  public static final ExecutorService NUM_INFO_UPLOAD_POOL = Executors.newSingleThreadExecutor();
    
    //纯后台任务，很多操作都使用此线程池。
    public static ExecutorService pool = Executors.newFixedThreadPool(1);
    public final static String TNAME_LOCAL_BG ="xy_local_bg_1";
    //多种后台任务的处理
    public static final ExecutorService iccidPool = Executors.newFixedThreadPool(1);
    public final static String TNAME_NET_BG ="xy_net_bg_1";
    
    //会话缓存及日志处理，纯后台任务
    public static ExecutorService dexUtilPool = Executors.newFixedThreadPool(1);
    public final static String TNAME_DEXUTIL_POOl="xy_dexutil_pool_1";
    
    //基础识别
    public static ExecutorService baseParseService= Executors.newFixedThreadPool(1);
    public final static String TNAME_BASEPARSE="xy_baseparse_1";

    //特征值识别
    private static ExecutorService baseParseServiceAsyn= null;//Executors.newFixedThreadPool(1);
    public final static String TNAME_FEATUREPASE="xy_feature_parse_1";
    //提取url，检验url
//    public static ExecutorService msgUrlPool = Executors.newFixedThreadPool(1);
    //查询火车车次数据
//  public static ExecutorService mQueryTrainInfoPool = Executors.newFixedThreadPool(1);
//  public final static String TNAME_QUERYTRAIN="xy_querytrain_1"; 
    
    //webActivity 中获取数据,提取url，检验url 相关,查询火车车次数据
    public static ExecutorService netWebPool = Executors.newFixedThreadPool(2);
    public final static String TNAME_SERVICE_DATA_QUERY="xy_service_data_query";
    /*SDK-633 hewengao 20161009 end*/
    /***
     * 设置线程名称及线程级别
     * @param threadName
     * @param priority
     */
    public static void setThreadNameAndPriority(String threadName,int priority){
        try{
            Thread thread = Thread.currentThread();
            thread.setName(threadName+ thread.hashCode());
            android.os.Process.setThreadPriority(priority);
        }catch(Throwable e){
            //e.printStackTrace();
        }
    }
    
    /* SDK-657 zhaojiangwei 20161101 start */
    public synchronized static ExecutorService getBaseParseServiceAsyn(){
        if(baseParseServiceAsyn == null){
            //synchronized (richPool) {
                baseParseServiceAsyn = Executors.newFixedThreadPool(1);
            //}
        }
        return baseParseServiceAsyn;
    }
    public synchronized static ExecutorService getLogoService(){
        if(publicLogoPool == null){
            //synchronized (richPool) {
                publicLogoPool = Executors.newFixedThreadPool(1);
            //}
        }
        return publicLogoPool;
    }
    /*SDK-656 hewengao 20161028 start*/
    public synchronized static ExecutorService getMsgUrlPool(){
        if(msgUrlPool == null){
            //synchronized (richPool) {
                msgUrlPool = Executors.newFixedThreadPool(1);
           // }
        }
        return msgUrlPool;
    }
     /*SDK-656 hewengao 20161028 end*/
    /* SDK-657 zhaojiangwei 20161101 end */
}
/*SDK-616 hewengao/20160918 end*/
